//
//  AppDelegate.m
//  MiaMind
//
//  Created by Vill on 2023/11/23.
//

#import "AppDelegate.h"
#import "MMLoginController.h"
#import "AIRegisterController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.window.backgroundColor = UIColor.whiteColor;
    self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[MMLoginController new]];
    [self.window makeKeyAndVisible];
    [self changeRootVc];
    return YES;
}

- (void)changeRootVc{
    AIUserInfoModel *manager = [[AIUserInfoManager shareManager] userInfo];
    if (manager.token.length > 0){
        self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[AIRegisterController new]];
    }else{
        self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[MMLoginController new]];
    }
}



@end
